home *** CD-ROM | disk | FTP | other *** search
- package sun.net.www.protocol.systemresource;
-
- import java.net.URL;
-
- class ParseSystemURL {
- private String base;
- private String member;
- private boolean isAFile;
- private boolean isInZip;
-
- public ParseSystemURL(URL url) {
- String file = url.getFile();
- if (file.startsWith("/FILE")) {
- this.isAFile = true;
- file = file.substring(5);
- } else {
- if (!file.startsWith("/ZIP")) {
- return;
- }
-
- this.isInZip = true;
- file = file.substring(4);
- }
-
- this.base = file.substring(0, file.indexOf("/+/"));
- this.member = file.substring(file.indexOf("/+/") + 3);
- }
-
- public String getBase() {
- return this.base;
- }
-
- public String getMember() {
- return this.member;
- }
-
- public boolean isFile() {
- return this.isAFile;
- }
-
- public boolean isValid() {
- return this.isAFile || this.isInZip;
- }
-
- public boolean isZip() {
- return this.isInZip;
- }
- }
-